Những câu hỏi liên quan
Hoàng Long
Xem chi tiết
Nguyễn Lê Phước Thịnh
25 tháng 2 2021 lúc 21:49

const fi='input.txt'

fo='chiahet.txt'

var f1,f2:text;

a:array[1..100]of integer;

i,n,dem:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

n:=0;

while not eoln(f1) do 

begin

inc(n);

read(f1,a[n]);

end;

dem:=0;

for i:=1 to n do

if a[i] mod 3=0 then inc(dem);

writeln(f2,dem);

close(f1);

close(f2);

end.

Bình luận (0)
Huệ Bùi Thị Kim
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 4 2022 lúc 10:04

#include <bits/stdc++.h>
using namespace std;
unsigned long long a,b;
//chuongtrinhcon
unsigned long long ucln(long long a,long long b)
{
    if (b==0) return(a);
    else return(ucln(b,a%b));
}
//chuongtrinhchinh
int main()
{
    freopen("vidu.inp","r",stdin);
    freopen("vidu.out","w",stdout);
    cin>>a>>b;
    cout<<ucln(a,b);
    return 0;
}

 

Bình luận (0)
An Đinh
Xem chi tiết
Minh Lệ
19 tháng 3 2023 lúc 22:52

Program HOC24;

var i,n: integer;

a: array[1..1000] of integer;

t: longint;

f1,f2: text;

const fi='DATA1.TXT'

fo='KQ1.TXT'

begin

assign(f1,fi);

assign(f2,fo);

reset(f1);

rewrite(f2);

readln(f1,n);

for i:=1 to n do read(f1,a[i]);

t:=0;

for i:=1 to n do if a[i] mod 2=0 then t:=t+a[i];

writeln(f2,t);

for i:=1 to n do if a[i] mod 5=0 then write(f2,a[i],' ');

close(f1); close(f2);

end.

Bình luận (0)
Dương Hữu Thành
Xem chi tiết
U Lan
Xem chi tiết
U Lan
Xem chi tiết
U Lan
Xem chi tiết
U Lan
Xem chi tiết
Ly Trần
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 4 2022 lúc 17:10

const fi='data1.txt'

fo='data2.txt'

var f1,f2:text;

a,b:real;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,a,b);

writeln(f2,(a+b)/2:4:2);

close(f1);

close(f2);

end.

Bình luận (0)